package com.leisurexi.aop.features.interceptor;

import com.leisurexi.aop.overview.EchoService;
import org.aopalliance.intercept.MethodInterceptor;
import org.aopalliance.intercept.MethodInvocation;

import java.lang.reflect.Method;

/**
 * 针对 {@link EchoService} 的方法拦截器
 *
 * @author: leisurexi
 * @date: 2021-05-21 16:10
 */
public class EchoServiceMethodInterceptor implements MethodInterceptor {

    @Override
    public Object invoke(MethodInvocation invocation) throws Throwable {
        Method method = invocation.getMethod();
        System.out.println("拦截 EchoService 的方法: " + method);
        return invocation.proceed();
    }

}
